<template>
  <div class="cart-list-item">
    <!--选择框-->
    <check-button :is-check="cartInfo.checked"  @click.native="checkClick"></check-button>
    <div class="item-left">

        <img :src="cartInfo.image" alt="">
    </div>
    <div class="item-right">
      <div class="title text">{{ cartInfo.title }}</div>
      <div class="desc text">{{ cartInfo.desc }}</div>
      <div class="CartInfo">
        <span class="price">￥{{ cartInfo.price }}</span>
        <span class="count">x{{ cartInfo.count }}</span>
      </div>
    </div>
  </div>

</template>

<script>
import checkButton from "../../home/childComps/CheckButton";

export default {
  name: "CartListItem",
  props: {
    cartInfo: {
      type: Object,
      default() {
        return []
      }
    }
  }, components: {
    checkButton
  },methods:{
    checkClick(){
      this.cartInfo.checked=(!this.cartInfo.checked);
    }
  }

}
</script>

<style scoped>
.cart-list-item {
  display: flex;
  padding: 10px 5px;
  border: 1px solid #a3a3a5;
  margin-right: -1px;
  margin-bottom: -1px;

}

.item-left {
  flex: 1;
  margin-left: 18px;
}

.item-left img {
  width: 100px;
  height: 125px;
  border-radius: 5px;

}

.item-right {
  flex: 3;
  overflow: hidden;
  padding-left: 10px;
}

.item-right div {
  margin: 15px 5px;

}


.text {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.title {
  font-size: 20px;
}

.desc {
  font-size: 15px;
}

.CartInfo {
  position: relative;
  bottom: -15px;
}

.price {
  float: left;
  color: #e96f45;
}

.count {
  float: right;
}
</style>